//
//  TestViewController4.m
//  MSDemo
//
//  Created by ms on 2022/2/9.
//

#import "TestViewController4.h"

@interface TestViewController4 ()
<
UITextFieldDelegate
>

ms_keyBoardTool

@end

@implementation TestViewController4

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"UITextField";
    
    NSArray *placeholders = @[@"placeholders1",
                              @"placeholders2placeholders2",
                              @"placeholders3placeholders3placeholders3",
                              @"placeholders4placeholders4placeholders4placeholders4",
                              @"placeholders5placeholders5placeholders5placeholders5placeholders5"];
    NSMutableArray *views = NSMutableArray.new;
    for (NSString *placeholder in placeholders)
    {
        UITextField *textField = UITextField.new;
        [textField ms_makeChains:^(MSChainMaker * _Nonnull make) {
            
            make
            .ms_backgroundColor(UIColor.redColor)
            .ms_delegate(self)
            .ms_font(MS_SYSTEM_FONT_OF_SIZE(15))
            .ms_placeholder(placeholder)
            .ms_addToSuperView(self.view)
            .ms_makeConstraints(^(MASConstraintMaker * _Nonnull make) {
                
                make.width.mas_equalTo(200);
                make.centerX.equalTo(self.view);
            });
        }];
        [views addObject:textField];
    }
    
    [views mas_distributeViewsAlongAxis:MASAxisTypeVertical
                    withFixedItemLength:40
                            leadSpacing:100
                            tailSpacing:200];
    self.keyBoardTool.fieldArray = views;
}


#pragma mark - UITextFieldDelegate
ms_lazyLoadingGetKeyBoardTool
- (void)textFieldDidBeginEditing:(UITextField *)textField
{
    AUTO_MOVE_TEXTFIELD_UP(textField, self.view, YES)
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
